<template>
  <basic-container>
    <filling-profit-sharer-list ref="fillingProfitSharerListRef" v-show="showType === 'list'"  @add="handleAdd" @detail="handleDetail"/>
    <filling-profit-sharer-add :info="currDetail" v-if="showType === 'add'" @back="handleBack"/>
  </basic-container>
</template>

<script>
import FillingProfitSharerList
  from "@/views/filling-profit-sharing-management/filling-profit-sharer/components/filling-profit-sharer-list";
import FillingProfitSharerAdd
  from "@/views/filling-profit-sharing-management/filling-profit-sharer/components/filling-profit-sharer-add";
import {isTrue} from "@/util/common-util";
export default {
  name: "index",
  components: {FillingProfitSharerAdd, FillingProfitSharerList},
  data() {
    return {
      showType: 'list',
      currDetail: {}
    }
  },
  created() {
  },
  methods:{
    handleAdd(){
      this.currDetail = null
      this.showType = 'add'
    },
    handleDetail(_row){
      this.currDetail = _row
      this.showType = 'add'
    },
    handleBack(flag) {
      this.showType = 'list'
      if (isTrue(flag)) this.$refs.fillingProfitSharerListRef.query()
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
